package com.woniuxy.test02;

import org.junit.Test;

import java.util.Arrays;

/**
 * @Author author
 * @Create 2023-09-12 9:50
 */
public class MyTest01 {

    public void testInt(int i){
        i=5;
        System.out.println("调用中："+i);
    }

    @Test
    public void testtestInt(){
        int i=1;
        System.out.println("调用前："+i);
        testInt(i);
        System.out.println("调用后："+i);
    }


    public void testArray(int[] a){
        for(int i=0;i<a.length;i++){
            a[i]+=1;
        }
        System.out.println("调用中："+ Arrays.toString(a));
    }

    @Test
    public void testtestArray(){
        int[] a={1,2,3};
        System.out.println("调用前："+ Arrays.toString(a));
        testArray(a);
        System.out.println("调用后："+ Arrays.toString(a));
    }

    public void testString(String str){
        str+="zzz";
    }

    @Test
    public void testtestString(){
        String str="aaa";
        testString(str);
        System.out.println(str);
    }

    public void testStringBuilder(StringBuilder sb){
        sb.append("zzz");
    }

    @Test
    public void testtestStringBuilder(){
        StringBuilder sb=new StringBuilder("aaa");
        testStringBuilder(sb);
        System.out.println(sb);
    }

    public void swap(int x,int y){
        int t=x;
        x=y;
        y=t;
        System.out.println("x="+x+",y="+y);
    }

    @Test
    public void testswap(){
        int x=1;
        int y=2;
        System.out.println("x="+x+",y="+y);
        swap(x,y);
        System.out.println("x="+x+",y="+y);
    }
}
